package com.example.sort;

import java.util.Arrays;

/**
 * 冒泡排序
 * @author zhanpengguo
 * @date 2019-07-30 15:52
 */
public class MaoPao {

    public static Integer[] sort(Integer[] array) {
        Integer[] ints = Arrays.copyOf(array, array.length);
        for (int i = 0; i < ints.length; i++) {
            for (int j = i; j < ints.length; j++) {
                if (ints[i] > ints[j]) {
                    int temp = ints[i];
                    ints[i] = ints[j];
                    ints[j] = temp;
                }
            }
        }
        return ints;
    }
}
